package com.gin.kotlin.gf2gamecommunity.network.gitee.main

import com.gin.kotlin.gf2gamecommunity.base.LogInterceptor
import com.gin.retrofit.factory.QueryParameterConverterFactory
import com.gin.retrofit.utils.JacksonUtils
import com.gin.retrofit.utils.OkhttpUtils
import retrofit2.Retrofit
import retrofit2.converter.jackson.JacksonConverterFactory

class GiteeRetrofit {

    companion object {
        private const val HOST = "https://gitee.com/api/v5/"
        private val TAG = GiteeRetrofit::class.java.simpleName
        fun build(): Retrofit {
            return Retrofit.Builder()
                .baseUrl(HOST)
                .addConverterFactory(JacksonConverterFactory.create(JacksonUtils.MAPPER))
                .addConverterFactory(QueryParameterConverterFactory())
                .client(OkhttpUtils.obtainOkHttpClient().newBuilder().addInterceptor(LogInterceptor()).build())
                .build()
        }
    }
}